<form id="${classNameLower}EditForm" class="parsley-form" data-parsley-validate role="form" method="post" action="${action}/edit/do">
    <input type="hidden" name="id" value="$!${classNameLower}.id"/>
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h4 class="modal-title">编辑</h4>
    </div>
    <div class="modal-body">
        #foreach($!column in $!columns.entrySet())
        #set($v = $!column.value)
        #if($!v.get("primary") == false && $!v.get("fieldName") != "createUser" && $!v.get("fieldName") != "createTime" && $!v.get("fieldName") != "version")
        <div class="row">
            <div class="col-lg-12 col-md-12">
                <div class="form-group">
                    <label class="control-label">${v.get("displayName")}</label>
                    #set($k = "_!"+${classNameLower}+"."+${v.get("fieldName")})
                    #set($p = "_ifChecked(" + $!k.replace('_','$')+")")
                    #if($!v.get("type") == "boolean")
                    <input type="checkbox" class="js-switch-blue" name="${v.get('fieldName')}" $!p.replace("_","#")>
                    #else
                    <input type="text" class="form-control" name="${v.get('fieldName')}" value="$!k.replace('_','$')" #if($v.get("nullable") == false)data-parsley-required="true"#end placeholder="${v.get('displayName')}"  maxlength="${v.get('length')}">
                    #end
                </div>
            </div>
        </div>
        #end
        #end
    </div>
    <div class="modal-footer">
        <button type="submit" class="btn btn-primary btn-form-submit" data-loading-text="正在保存...">提  交</button>
        <button type="button" class="btn btn-default" data-dismiss="modal">取  消</button>
    </div>
</form>
<script type="text/javascript">
    ns.ready(function(){
        ns.requireJS([
            "/framework/js/form/form.js",
            "/framework/js/form/validator.js"
        ]);
        var dialog = ns.view.Dialog.getCur("#${classNameLower}EditForm");

        dialog.find("#${classNameLower}EditForm").ajaxForm({
            beforeSubmit:function(arr, form, options){
                form.find("button:submit").button("loading");
            },
            success : function(data, statusText, xhr, form) {
                if(data.success === true){
                    ns.tip.toast.success("更新成功！");
                    dialog.close({isEdited:true});
                }else{
                    ns.tip.toast.error(data.message);
                }
                form.find("button:submit").button("reset");
            }
        });
    });
</script>